import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

// 引入echarts组件库
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts

// 引入element-ui组件库
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

Vue.config.productionTip = false
Vue.filter('dateTime', (e) => {
  if (e < 10000000000) {
    e = e * 1000
  }
  let d = new Date(e)
  let yy = d.getFullYear()
  let mm = d.getMonth() + 1
  let dd = d.getDate()
  let hh = d.getHours()
  let ss = d.getMinutes()
  let s2 = d.getSeconds()

  mm = mm < 10 ? '0' + mm : mm
  dd = dd < 10 ? '0' + dd : dd
  hh = hh < 10 ? '0' + hh : hh
  ss = ss < 10 ? '0' + ss : ss
  s2 = s2 < 10 ? '0' + s2 : s2

  return `${yy}-${mm}-${dd} ${hh}-${ss}-${s2}`
})


// 读取上传文件的基础路径前缀，保存为vue全局变量
import URLENV from '@/http/BaseUrl'
Vue.prototype.UPLOADURL = URLENV.UPLOADURL
// 如上写法，UPLOADURL成为了Vue对象的成员属性，在组件中随意访问

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
